using System.Data;
using System.Data.SqlClient;
using VanTaiProperty;
namespace VanTaiData
{
    public class clsTMDO_BILLController
    {
        private clsConnect cls = new clsConnect();

        #region[Get-Data]
        public DataTable BindGirdTMDO_BILL()
        {
            return cls.BindGridData("sp_TMDO_BILL");
        }
        public DataTable BindGirdTMDO_BILL_Detail_Edit(int id)
        {
            return cls.LayDuLieuParameter("sp_TMDO_BILL_Detail", "@DO_BILL_ID", id);
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool InsertTMDO_BILL(clsTMDO_BILLProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@DO_BILL_Alias", data.DO_BILL_Alias);
            cls.AddParameter("@DO_ID", data.DO_ID);
            cls.AddParameter("@DO_Quality", data.DO_Quality);
            cls.AddParameter("@DO_BILL_Price", data.DO_BILL_Price);
            cls.AddParameter("@DO_BILL_Price_Total", data.DO_BILL_Price_Total);
            cls.AddParameter("@DO_BILL_Date", data.DO_BILL_Date);
            cls.AddParameter("@NetWeight", data.NetWeight);
            cls.AddParameter("@DO_BILL_Discription", data.DO_BILL_Discription);
            cls.AddParameter("@DO_BILL_Status", data.DO_BILL_Status);
            cls.AddParameter("@DO_BILL_USER_ID", data.DO_BILL_USER_ID);
            cls.ExecuteNonQuery("sp_TMDO_BILL_Insert");
            return true;
        }
        public bool UpdateTMDO_BILL(clsTMDO_BILLProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@DO_BILL_ID", data.DO_BILL_ID);
            cls.AddParameter("@DO_BILL_Alias", data.DO_BILL_Alias);
            cls.AddParameter("@DO_ID", data.DO_ID);
            cls.AddParameter("@DO_Quality", data.DO_Quality);
            cls.AddParameter("@DO_BILL_Price", data.DO_BILL_Price);
            cls.AddParameter("@DO_BILL_Price_Total", data.DO_BILL_Price_Total);
            cls.AddParameter("@DO_BILL_Date", data.DO_BILL_Date);
            cls.AddParameter("@NetWeight", data.NetWeight);
            cls.AddParameter("@DO_BILL_Discription", data.DO_BILL_Discription);
            cls.AddParameter("@DO_BILL_Status", data.DO_BILL_Status);
            cls.AddParameter("@DO_BILL_USER_ID", data.DO_BILL_USER_ID);
            cls.ExecuteNonQuery("sp_TMDO_BILL_Update");
            return true;
        }
        public bool UpdateTMDO_BLL_Update_Quality(clsTMDO_BILLProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@DO_BILL_ID", data.DO_BILL_ID);
            cls.AddParameter("@DO_Quality", data.DO_Quality);
            cls.ExecuteNonQuery("sp_TMDO_BILL_Update_Quality");
            return true;
        }
        public bool DeleteTMDO_BILL(int id)
        {
            cls.Delete("sp_TMDO_BILL_Delete", "@DO_BILL_ID", id);
            return true;
        }
        #endregion

        #region[Search]
        public DataTable Search(string keywords)
        {
            return cls.Search("sp_TMDO_BILL_Search", "@KEYWORDS", keywords);
        }
        #endregion
    }
}